#ifndef __BSP_GPIO_H__
#define __BSP_GPIO_H__

#include "stm32f4xx.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_tim.h"
#include "stm32f4xx_i2c.h"
#include "stm32f4xx_spi.h"
#include "stm32f4xx_exti.h"
#include "stm32f4xx_dma.h"
#include "stm32f4xx_adc.h"


#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include <stdio.h>
#include <stdbool.h>
#include "delay.h"
#include "misc.h"

#include "bsp_led.h"
#include "bsp_key.h"
#include "bsp_uart.h"
#include "bsp_time.h"
#include "bsp_flash.h"
#include "bsp_spi.h"
/*LED指示灯*/
#define LED_GPIO_CLK                  (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOD)
// 电源
#define LED_START_STOP_PORT           GPIOA
#define LED_START_STOP_PIN            GPIO_Pin_6
// 故障
#define LED_FAULT_PORT                GPIOA
#define LED_FAULT_PIN                 GPIO_Pin_7
   

/*按键*/  
#define KEY_GPIO_CLK                  (RCC_AHB1Periph_GPIOA | RCC_AHB1Periph_GPIOE)
     
#define KEY_START_STOP_PORT           GPIOE
#define KEY_START_STOP_PIN            GPIO_Pin_4

#define KEY_MODE_PORT                 GPIOE
#define KEY_MODE_PIN                  GPIO_Pin_3

#define KEY_WKUP_PORT                 GPIOA
#define KEY_WKUP_PIN                  GPIO_Pin_0

/*串口*/ 
#define DEBUG_UART_GPIO_CLK           (RCC_AHB1Periph_GPIOB)
#define DEBUG_UART_INIT_CLK           (RCC_APB1Periph_USART3)

#define DEBUG_UART_TX_PORT            GPIOB
#define DEBUG_UART_TX_PIN             GPIO_Pin_10

#define DEBUG_UART_RX_PORT            GPIOB
#define DEBUG_UART_RX_PIN             GPIO_Pin_11

#define UART_GPIO_CLK                 (RCC_AHB1Periph_GPIOA)
#define UART_INIT_CLK                 (RCC_APB1Periph_USART2)

#define UART_TX_PORT                  GPIOA
#define UART_TX_PIN                   GPIO_Pin_2
#define UART_TX_SOURCE                GPIO_PinSource2
#define UART_TX_AF                    GPIO_AF_USART2

#define UART_RX_PORT                  GPIOA
#define UART_RX_PIN                   GPIO_Pin_3
#define UART_RX_SOURCE                GPIO_PinSource3
#define UART_RX_AF                    GPIO_AF_USART2


void bsp_gpio_init(void);

#endif 
